package com.hxd.otc.module.convenience.adapter;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.hxd.otc.R;
import com.hxd.otc.module.convenience.bean.ConvenienceOrderBean;
import com.hxd.otc.utils.StringUtil;
import com.hxd.otc.utils.UIUtils;

/**
 * 作  者 :  zjl
 * 时  间 :  2018/12/13 11:21
 * 描  述 :  ${便民订单Adapter}
 */
public class ConvenienceOrderAdapter extends BaseQuickAdapter<ConvenienceOrderBean, BaseViewHolder> {
    String[] statuusType;

    public ConvenienceOrderAdapter() {
        super(R.layout.adapter_convenience_order, null);
        statuusType = UIUtils.getContext().getResources().getStringArray(R.array.convenience_order_statues);
    }

    @Override
    protected void convert(BaseViewHolder helper, ConvenienceOrderBean item) {

        helper.setText(R.id.tv_title, item.getGoodsName());
        helper.setText(R.id.tv_number, StringUtil.handleZero(item.getVolume()) + " " + item.getSymbol());
        helper.setText(R.id.tv_time, item.getUpdateDate());

        switch (item.getStatus()) {//  状态：0 未知 1 充值中 2 充值失败 3 充值成功 4.订单异常 5.充值失败(撤单)
            case 0:
                helper.setText(R.id.tv_statues, statuusType[0]);
                helper.setTextColor(R.id.tv_statues, UIUtils.getContext().getResources().getColor(R.color.color_FFFF7766));
                break;
            case 1:
                helper.setText(R.id.tv_statues, statuusType[1]);
                helper.setTextColor(R.id.tv_statues, UIUtils.getContext().getResources().getColor(R.color.color_FF464E5F));
                break;
            case 2:
                helper.setText(R.id.tv_statues, statuusType[2]);
                helper.setTextColor(R.id.tv_statues, UIUtils.getContext().getResources().getColor(R.color.color_FFFF7766));
                break;
            case 3:
                helper.setText(R.id.tv_statues, statuusType[3]);
                helper.setTextColor(R.id.tv_statues, UIUtils.getContext().getResources().getColor(R.color.color_FF95A2AC));
                break;
            case 4:
                helper.setText(R.id.tv_statues, statuusType[4]);
                helper.setTextColor(R.id.tv_statues, UIUtils.getContext().getResources().getColor(R.color.color_FFFF7766));
                break;
            case 5:
                helper.setText(R.id.tv_statues, statuusType[5]);
                helper.setTextColor(R.id.tv_statues, UIUtils.getContext().getResources().getColor(R.color.color_FFFF7766));
                break;
        }
    }

}
